from django.contrib import admin
from .models import Tenant, FormTemplate, FormField, FormSubmission

@admin.register(Tenant)
class TenantAdmin(admin.ModelAdmin):
    list_display = ('name', 'created_at')
    search_fields = ('name',)

@admin.register(FormTemplate)
class FormTemplateAdmin(admin.ModelAdmin):
    list_display = ('title', 'tenant', 'created_at')
    list_filter = ('tenant',)
    search_fields = ('title',)

@admin.register(FormField)
class FormFieldAdmin(admin.ModelAdmin):
    list_display = ('template', 'label', 'field_type', 'required', 'order')
    list_filter = ('template', 'field_type', 'required')
    search_fields = ('label',)
    ordering = ('template', 'order')

@admin.register(FormSubmission)
class FormSubmissionAdmin(admin.ModelAdmin):
    list_display = ('template', 'submitted_by', 'submitted_at')
    list_filter = ('template', 'submitted_by')
    date_hierarchy = 'submitted_at' 